
# 13. 求s=a+aa+aaa+aaaa+aa...a的值，其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加)，几个数相加由键盘控制。
"""
2 = 2 + 0 = 2 * 10 ** 0
22 = 20 + 2 = 2 * 10 ** 1
222 = 200 + 22
2222 = 2000 + 222
22222 = 20000 + 2222
total = 2 * 10 ** (n-1) + m
"""
a = 2
n = int(input("请输入一个数:"))
s = 0
sum = 0
for x in range(n):
    s += a * 10 ** x
    sum += s
print(sum)


# 14. 题目：打印出如下图案（菱形）:
for n in range(1,5):
    star = (2 * n - 1) * '*'
    print(star.center(7))
for n in range(1,4):
    star = (7 - 2*n) * '*'
    print(star.center(7))